import { SET_TAGS, TAGS_ACTION, GET_TAGS, STORAGE_TAGS } from '@/utils/Const';
import Storage from '@/utils/Storage';
import { deepCopy } from '@/utils/tools';
export default {
	namespaced : true,
	state : {
		value : Storage.get(STORAGE_TAGS, 1) || {
			editableTabsValue : '首页',
			editableTabs : [
				{
					title : '首页',
					path : '/dashboard'
				}
			]
		}
	},
	getters : {
		[GET_TAGS] (state) {
			return state.value;
		}
	},
	mutations : {
		[SET_TAGS] (state, payload) {
			state.value = deepCopy(payload);
			Storage.set(STORAGE_TAGS, state.value, 1);
		}
	},
	actions : {
		[TAGS_ACTION] ({ commit }, payload) {
			commit(SET_TAGS, payload);
		}
	}
};
